<template>
	<view class="newCollection mtb-16">
		<swiper class="swiper" :autoplay="isplay" :circular="isplay" next-margin="200rpx" v-if="isSwiper && list.length">
			<swiper-item v-for="(item,idx) in list" :key="idx">
				<new-collection-item :type="1" :product="item"></new-collection-item>
			</swiper-item>
		</swiper>
		
		<block v-for="(item,idx) in list" :key="idx" @click="toDetail(item)" v-else>
			<new-collection-item :type="2" :product="item"></new-collection-item>
		</block>
		
		<view class="ptb-20" v-if="!list.length">
			<w-loading type="empty" emptyType="search"></w-loading>
		</view>
	</view>
</template>

<script>
	import newCollectionItem from './new-collection-item.vue'
	export default {
		props:{
			list:Array
		},
		computed:{
			// isSwiper() {
			// 	return this.list.length>1
			// },
			isSwiper() {
				return true // 设置为true以启用轮播功能
			},
			isplay() {
				return this.list.length>2
			}
		},
		components:{ newCollectionItem }
	}
</script>

<style lang="scss" scoped>
	.newCollection{
		.swiper{
			height: 520rpx;
			border-top-left-radius: 24rpx;
			overflow: hidden;
		}
	}
</style>
